function varerr(time,y,R,sig,y0)

load('orthbase');

exactvar=zeros(1,100);
time(1)=10^-15;

for ii=1:100
%     exactvar(ii)=(y0(1)+quadl(@(s) R(s)-1/2*sig(s).*sig(s),0,time(ii)))^2 ...
%         +quadl(@(s) sig(s).*sig(s),0,time(ii));
      exactvar(ii)=quadl(@(s) sig(s).*sig(s),0,time(ii));
end
hold on
plot(time,exactvar);
tmp=zeros(size(y(:,1)));
for ii=2:size(y,2)
    tmp=tmp+y(:,ii).*y(:,ii);
end
plot(time,tmp,'r-');
title('Variance')
legend('exact var','wce var');
